package com.fis.test3.Repository;

import com.fis.test3.model.FiberPerpare;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface FPRepository extends JpaRepository<FiberPerpare,Long> {
    List<FiberPerpare> findBycontractIdContaining(String contractId);

    @Query("select p from FiberPerpare p where p.contractId=:contractId and p.cusUnit=:cusUnit")
    FiberPerpare withNameAndAddressQuery(@Param("contractId") String contractId, @Param("cusUnit") String cusUnit);

     FiberPerpare getByContractId(String ContractId);

    FiberPerpare save(FiberPerpare fp);

    boolean existsByContractId(String ContractId);
    boolean existsByContractIdAndFiberTypeAndFiberLength(String ContractId,String FiberType,int FiberLength);
    FiberPerpare findByContractIdAndFiberTypeAndFiberLength(String ContractId,String FiberType,int FiberLength);

}
